using System;

namespace Arcane.Source.Combat
{
    public abstract class BaseStatusEffect : ITrigger
    {
        public event Action<float> OnLifeChange;
        public event Action<int> OnCountChange;

        public bool Show { get; set; } = true;

        public abstract float Life { get; }
        private int _count = 1;
        public int Count
        {
            get => _count;
            set
            {
                _count = value;
                OnCountChange?.Invoke(_count);
            }
        }
        public bool Valid => Life > 0;

        public abstract void OnStack(ITrigger trigger);
        
        public virtual void OnReady(Entity host) { }
        public virtual void OnRemove(Entity host) { }
        public virtual void OnTick(Entity host) { }

        protected void NotifyLifeChange()
        {
            OnLifeChange?.Invoke(Life);
        }
    }
}